<template>
  <div>
    <v-branch></v-branch>
    <div>
      <el-button class="btn" @click="add" type="primary" plain size="small"
        >添加</el-button
      >
    </div>
    <v-list @edit="edit"></v-list>
    <v-dialog ref="dialogInfo" @cancel="cancel" :info="info"></v-dialog>
  </div>
</template>

<script>
import vList from "./list.vue";
import vDialog from "./dialog.vue";
export default {
  data() {
    return {
      info: {
        isShow: false, //控制弹框显示隐藏
        isAdd: true, //用于区分添加或者编辑
      },
    };
  },

  components: {
    vList,
    vDialog,
  },
  methods: {
    add() {
      //添加
      this.info.isShow = true;
      this.info.isAdd = true;
    },
    edit(e){
      this.info.isShow=true;
      this.info.isAdd=false;
      this.$refs.dialogInfo.lookup(e)
    },
    cancel(e){
      this.info.isShow=e
    }
  },
};
</script>

<style scoped>
.btn {
  margin: 10px;
}
</style>
